from src.utrls import DefUtrl


def run(notice_data: dict):
    """
    头像戳一戳事件
    :param notice_data:
    :return:
    """
    user_id = notice_data["user_id"]  # 发送者
    target_id = notice_data["target_id"]  # 被戳者
    if notice_data.get("sender_id", 0) == 0:  # 群里戳一戳事件
        _group_poke(notice_data, user_id, target_id)
        return
    _private_poke(notice_data, user_id)  # 私聊中被戳一戳


def _group_poke(poke_data: dict, user_id: int, target_id: int):
    """
    群戳一戳事件
    :param poke_data: 戳一戳数据
    :param user_id: 发送者
    :param target_id: 被戳者
    :return:
    """
    _time = poke_data["time"]
    DefUtrl.voice("群聊收到戳一戳")
    group_id = poke_data["group_id"]  # 群号(仅群聊)
    print("=" * 20)
    print(f"{DefUtrl.format_timestamp(_time)} 群聊【{group_id}】戳一戳事件:戳一戳发送者:【{user_id}】_被戳者【{target_id}】")
    print("=" * 20)
    pass


# 等级名单，反之重复出发戳一戳
# 后面看情况调整
_sr_Map = {
    "group": [],
    "private": []
}


def _private_poke(poke_data: dict, user_id: int):
    """
    私聊戳一戳事件
    :param poke_data: 戳一戳数据
    :param user_id: 发送者
    :return:
    """
    _time = poke_data["time"]
    DefUtrl.voice("私聊收到戳一戳")
    print("=" * 20)
    print(f"{DefUtrl.format_timestamp(_time)} 私聊戳一戳事件:戳一戳发送者:【{user_id}】")
    print("=" * 20)
    pass
